using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace DataLayerTest.Models.Mapping
{
    public class PlayerSetTopBoxMap : EntityTypeConfiguration<PlayerSetTopBox>
    {
        public PlayerSetTopBoxMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("PlayerSetTopBox");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdPlayer).HasColumnName("IdPlayer");
            this.Property(t => t.IdSetTopBox).HasColumnName("IdSetTopBox");

            // Relationships
            this.HasRequired(t => t.Player)
                .WithMany(t => t.PlayerSetTopBoxes)
                .HasForeignKey(d => d.IdPlayer);
            this.HasRequired(t => t.SetTopBox)
                .WithMany(t => t.PlayerSetTopBoxes)
                .HasForeignKey(d => d.IdSetTopBox);

        }
    }
}
